package cn.ubeta.b2c.common;

import cn.ubeta.b2c.widget.TitleBar;

/**
 * Created by liudengyong on 16/8/27.
 */

public abstract class BaseCartActivity extends AnalyseActivity implements CartCommon.ICartListener {

    protected abstract TitleBar getTitleBar();

    @Override
    protected void onResume() {
        super.onResume();
        CartCommon.addListener(this);
        notifyShopCartCountChanged(CartCommon.getCartCount(), false);
    }

    @Override
    protected void onStop() {
        super.onStop();
        CartCommon.removeListener(this);
    }

    @Override
    public void notifyShopCartCountChanged(int count, boolean showAnimation) {
        if (getTitleBar() != null)
            getTitleBar().refreshCartCount(count, showAnimation);
    }

}
